﻿Imports System.Windows.Forms

Public Class Acad_WhichSheetDialog

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        If Me.Text = "Which work sheet?" Then
            If SheetBox.SelectedItems.Count = 0 Then

                MessageBox.Show("You must select a sheet", "No sheet has been selected", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub

            End If
        End If


        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim s1 As String = String.Empty
        Dim r As Integer


        For r = 0 To SheetBox.Items.Count - 1
            s1 &= SheetBox.Items(r) & Environment.NewLine

        Next

        If Not s1 = "" Then
            Clipboard.SetText(s1)
        End If
    End Sub
End Class
